<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">

    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    
    let App={
        template:`<div>
            <input type='text' ref='input' v-if='isShow'/>
        </div>`,
        data(){
            return {
                isShow:false
            }
        },
        mounted(){
            this.isShow=true;
            // 因为显示没有立即执行  导致下方没办法立即获取dom 
            //  // this.$refs.input.focus();
            this.$nextTick(()=>{
                this.$refs.input.focus()
            })
        },
        
    }

    new Vue({
        el:'#app',
        template:`<app/>`,
        components:{app:App}
    })
</script>
</html>